package io.gitee.chearnee.fw.openapi.constant;

import org.springframework.core.NamedThreadLocal;

/**
 * @author cn
 * @version 1.0
 * @description
 * @date 2021/9/26 16:56
 */
public class OpenApiContextHolder {

  private static final ThreadLocal<OpenApiContext> OPEN_API_CONTEXT = new NamedThreadLocal<>(
      "openApi");

  public static OpenApiContext getOpenApiContext() {
    return OPEN_API_CONTEXT.get();
  }

  public static void setOpenApiContext(OpenApiContext openApiContext) {
    OPEN_API_CONTEXT.set(openApiContext);
  }

  public static void remove() {
    OPEN_API_CONTEXT.remove();
  }
}
